import { IKeyObject } from './keyobject'
import { IArea } from './overlay'
import { IPosition } from './position'

/**
 * @title 多源数据类型
 * @description
 */
type IMultiDataType =
    | 'tif'
    | 'zip'
    | 'document'
    | 'video'
    | 'image'
    | 'audio'
    | 'obj'
    | 'db'
    | 'shp'

/**
 * @title 数据来源
 * @description 爬取/生成/采购/用户上传
 */
type IDataSourceType = 'crawl' | 'generate' | 'buy' | 'upload'

interface IGeometry {
    geometry: {
        center_coording: number[]
        coordinates: number[][]
        envlop: number[][]
        type: 'Polygon'
    }
    properties: {
        country: string
        country_code: string
        y_cellsize: number
        created_time: string
        x_cellsize: number
        file_name: string
        file_type: string
        width: number
        band_count: number
        satellite_type: string
        file_size: number
        height: number
        spatial_ref: string
    }
    type: 'Feature'
    thumbnails: string
}

type IDetailType = IGeometry

/**
 * @title 基础多源数据类型
 * @description 所有多源数据的基类
 */
type IMultiData =
    | {
          // dataId: string
          // relateKeyObject?: IKeyObject[]
          // createDate: string
          // source: IDataSourceType

          type: IMultiDataType
          type_name: string
          suffix: string
          status: number
          relpath: string
          keywords: string
          id: string
          file_size: number
          filepath: string
          filename: string
          details: IDetailType
          data_sources: IDataSourceType
          created_time: string
          // TODO:
      }
    | IMultiDataNews

interface IMultiDataNews {
    type: 'news'
    type_name: string
    suffix: string
    status: number
    relpath: string
    keywords: string
    id: string
    file_size: number
    filepath: string
    filename: string
    details: {
        content: string
        crawtime: string
        id: string
        imgs: string
        name: string
        releasetime: string
        source: string
        title: string
    }
    data_sources: IDataSourceType
    created_time: string
}

interface IMultiDataTif {
    type: 'tif'
    created_time: string
    data_sources: IDataSourceType
    // TODO:
    details: IGeometry
    filename: string
    filepath: string
    id: string
    keywords: string
}

export type {
    IMultiData,
    IMultiDataType,
    IDataSourceType,
    IMultiDataTif,
    IMultiDataNews,
    IDetailType,
    IGeometry,
}
